package com.caesar.exer1;

import org.junit.jupiter.api.Test;

import java.time.*;
import java.time.format.DateTimeFormatter;
import java.time.format.FormatStyle;

/**
 * @author caesar
 * @date 2025/7/15
 * @Description:
 * @apiNote
 */
public class Exercise {
    @Test
    public void test01(){
        LocalDateTime now = LocalDateTime.now();
        System.out.println(now);
        DateTimeFormatter df = DateTimeFormatter.ofLocalizedDateTime(FormatStyle.MEDIUM);
        System.out.println(df.format(now));
        df = DateTimeFormatter.ofPattern("yyyy年MM月dd日 HH时mm分ss秒  SSS毫秒  E 是这一年的D天");
        String str = df.format(now);
        System.out.println(str);
    }

    @Test
    public void test02(){
        LocalDateTime localDateTime = LocalDateTime.now();
        LocalDateTime chicagoDateTime = LocalDateTime.now(ZoneId.of("America/Chicago"));
        Duration duration = Duration.between(localDateTime,chicagoDateTime);
        System.out.println(duration);
    }

    @Test
    public void test03(){
        LocalDate localDate = LocalDate.now();
        LocalDate birthday = LocalDate.of(1995,5,1);

        Period p = Period.between(localDate,birthday);
        System.out.println(p);
    }
}
